package chixing.day20.proxy.homework.work2;

import java.util.List;
import java.util.Map;

public class Test {
    public static void main(String[] args) {
        Member member1 = new Member(1, "aaa", 2500);
        Member member2 = new Member(2, "bbb", 6000);
        Member member3 = new Member(3, "ccc", 1500);
        Member member4 = new Member(4, "ddd", 1600);

        OrderRecord orderRecord1 = new OrderRecord(member1, "套房", 1);
        OrderRecord orderRecord2 = new OrderRecord(member2, "高级房", 1);
        OrderRecord orderRecord3 = new OrderRecord(member3, "高级房", 1);
        OrderRecord orderRecord4 = new OrderRecord(member4, "普通房", 1);
        orderRecord1.Record();
        orderRecord2.Record();
        orderRecord3.Record();
        orderRecord4.Record();

        MemberService memberService = new MemberService();
        memberService.recordStay(orderRecord1);
        memberService.recordStay(orderRecord2);
        memberService.recordStay(orderRecord3);
        memberService.recordStay(orderRecord4);

        List<Member> topNMembers = memberService.getTopNMembers(3);
        System.out.println("前三名积分会员");
        topNMembers.forEach(System.out::println);

        Map<String, List<Member>> stringListMap = memberService.groupByLevel();
        System.out.println("各等级会员列表");
        for (Map.Entry<String, List<Member>> e:stringListMap.entrySet()) {
            System.out.println(e);
        }

    }
}
